Skip to content

fix: resolve RN 0.85 web warnings and upgrade Expo SDK 56#4958

Open
azizbecha wants to merge 1 commit into
callstack:mainfrom
azizbecha:@azizbecha/fix/rn-upgrade-warnings
Open

fix: resolve RN 0.85 web warnings and upgrade Expo SDK 56#4958
azizbecha wants to merge 1 commit into
callstack:mainfrom
azizbecha:@azizbecha/fix/rn-upgrade-warnings

Conversation

@azizbecha
Copy link
Copy Markdown
Collaborator

Summary

  • fix deprecated web shadow and Image style warnings introduced with React Native 0.85
  • move affected Image resizeMode and tintColor usage to props
  • upgrade the example app from Expo SDK 56 preview to stable SDK 56 and align related packages

Testing

  • yarn typescript
  • yarn jest src/components/tests/Icon.test.tsx src/components/tests/Surface.test.tsx src/components/tests/Appbar/Appbar.test.tsx -u --runInBand
  • npx expo-doctor
  • repo pre-commit hook (lint, typescript, full test suite)

@azizbecha azizbecha changed the title Fix RN 0.85 web warnings and upgrade Expo SDK 56 fix: resolve RN 0.85 web warnings and upgrade Expo SDK 56 May 21, 2026
@azizbecha azizbecha requested a review from satya164 May 21, 2026 00:05
@callstack-bot
Copy link
Copy Markdown

Hey @azizbecha, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@azizbecha azizbecha requested a review from adrcotfas May 21, 2026 22:53
Comment on lines +93 to +95
tintColor={color}
fadeDuration={0}
style={{ width: size, height: size, tintColor: color }}
style={{ width: size, height: size }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you seeing warnings about tintColor? I only see warnings for resizeMode and shadow*

Comment on lines +48 to +75
it('uses boxShadow instead of shadow props on web headers', () => {
const originalPlatform = Platform.OS;
Platform.OS = 'web';

try {
const { getByTestId } = render(
<mockSafeAreaContext.SafeAreaProvider>
<Appbar.Header elevated>
<Appbar.Content title="Examples" />
</Appbar.Header>
</mockSafeAreaContext.SafeAreaProvider>
);

const styles = StyleSheet.flatten(
getByTestId('appbar-header-root-layer').props.style
);

expect(styles).toMatchObject({
boxShadow: '0px 2px 6px rgba(0, 0, 0, 0.3)',
});
expect(styles).not.toHaveProperty('shadowColor');
expect(styles).not.toHaveProperty('shadowOpacity');
expect(styles).not.toHaveProperty('shadowOffset');
expect(styles).not.toHaveProperty('shadowRadius');
} finally {
Platform.OS = originalPlatform;
}
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test. Tests shouldn't test implementation details.

To test for deprecated styles an appropriate test would be to actually check whether there are console warnings. Though I think that's not really necessary.

Comment on lines +21 to +39
it('passes image-specific props without using deprecated style keys', () => {
const tintColor = 'tomato';
const source = { uri: 'https://picsum.photos/700' };
const { getByTestId } = render(
<Icon
source={source}
size={ICON_SIZE}
color={tintColor}
testID="image-icon"
/>
);
const imageIcon = getByTestId('image-icon');
const styles = StyleSheet.flatten(imageIcon.props.style);

expect(imageIcon.props.resizeMode).toBe('contain');
expect(imageIcon.props.tintColor).toBe(tintColor);
expect(styles).not.toHaveProperty('resizeMode');
expect(styles).not.toHaveProperty('tintColor');
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test

Comment on lines +20 to +44
it('renders web shadows with boxShadow instead of shadow props', () => {
const originalPlatform = Platform.OS;
Platform.OS = 'web';

try {
const { getByTestId } = render(
<Surface elevation={5} testID="surface-test">
{null}
</Surface>
);

const styles = StyleSheet.flatten(
getByTestId('surface-test').props.style
);

expect(styles).toMatchObject({
boxShadow: '0px 8px 12px rgba(0, 0, 0, 0.3)',
});
expect(styles).not.toHaveProperty('shadowColor');
expect(styles).not.toHaveProperty('shadowOpacity');
expect(styles).not.toHaveProperty('shadowOffset');
expect(styles).not.toHaveProperty('shadowRadius');
} finally {
Platform.OS = originalPlatform;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this test.

Comment on lines +37 to +41
const getShadowColor = (shadowColor: ColorValue, shadowOpacity: number) =>
color(typeof shadowColor === 'string' ? shadowColor : 'black')
.alpha(shadowOpacity)
.rgb()
.string();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a non-string is received on Web, it should throw an error as it's a user error instead of defaulting to black.

const getBoxShadowValue = (elevation: number, shadowColor: ColorValue) =>
`0px ${shadowLayers[0].height[elevation]}px ${
shadowLayers[0].shadowRadius[elevation]
}px ${getShadowColor(shadowColor, elevation ? 0.3 : 0)}`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for interpolations, this is doing color manipulation multiple times even though the color is not changing. Move this to the web branch and assign it to a variable, then reuse the variable in the shadow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants